package com.epsoft.odin7cj.flow.example;

import org.activiti.engine.DynamicBpmnService;
import org.activiti.engine.HistoryService;
import org.activiti.engine.IdentityService;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;

/**
 * 创建引擎
 * @author Administrator
 *
 */
public class C01BuildEngine {
	
	public static void main1(String[] args) {
		
		//通过代码设置
		/**
		ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
		        .setJdbcUrl("jdbc:mysql://47.98.183.17:3306/activiti")
		        .setJdbcUsername("root")
		        .setJdbcPassword("huyz")
		        .setJdbcDriver("com.mysql.jdbc.Driver")
		        .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
		ProcessEngine processEngine = cfg.buildProcessEngine();
		*/
		
		//通过activiti.cfg.xml配置文件
		ProcessEngineConfiguration cfg = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
		ProcessEngine engine = cfg.buildProcessEngine();
		
		//得到各个业务组件实例
		RepositoryService repositoryService = engine.getRepositoryService();
		RuntimeService runtimeService = engine.getRuntimeService();
		TaskService taskService = engine.getTaskService();
		IdentityService identityService = engine.getIdentityService();
		ManagementService managementService = engine.getManagementService();
		HistoryService historyService = engine.getHistoryService();
		DynamicBpmnService dynamicBpmnService = engine.getDynamicBpmnService();
		
		// 输入类名
		System.out.println(repositoryService.getClass().getName());
		System.out.println(runtimeService.getClass().getName());
		System.out.println(taskService.getClass().getName());
		System.out.println(identityService.getClass().getName());
		System.out.println(managementService.getClass().getName());
		System.out.println(historyService.getClass().getName());
		System.out.println(dynamicBpmnService.getClass().getName());
		
	}
	
	
}
